import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { OrderSalesDataVO, OrderSalesDataForm, OrderSalesDataQuery } from '@/api/business/orderSalesData/types';

/**
 * 查询订单销售数据信息列表
 * @param query
 * @returns {*}
 */

export const listOrderSalesData = (query?: OrderSalesDataQuery): AxiosPromise<OrderSalesDataVO[]> => {
  return request({
    url: '/system/orderSalesData/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询订单销售数据信息详细
 * @param id
 */
export const getOrderSalesData = (id: string | number): AxiosPromise<OrderSalesDataVO> => {
  return request({
    url: '/system/orderSalesData/' + id,
    method: 'get'
  });
};

/**
 * 新增订单销售数据信息
 * @param data
 */
export const addOrderSalesData = (data: OrderSalesDataForm) => {
  return request({
    url: '/system/orderSalesData',
    method: 'post',
    data: data
  });
};

/**
 * 修改订单销售数据信息
 * @param data
 */
export const updateOrderSalesData = (data: OrderSalesDataForm) => {
  return request({
    url: '/system/orderSalesData',
    method: 'put',
    data: data
  });
};

/**
 * 删除订单销售数据信息
 * @param id
 */
export const delOrderSalesData = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/orderSalesData/' + id,
    method: 'delete'
  });
};
